package cn.loioi.web.controller.admin.system;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.loioi.multi.mysql.model.SysLog;
import cn.loioi.multi.service.SysLogService;
import cn.loioi.web.common.BaseJqGridController;

/**
 * <br>
 * (c) Copyright 2016 by <br>
 * @description :日志 <br>
 * @file_name :SysLogContorller.java <br>
 * @system_name :multi_project_web <br>
 * @author :yyzh <br>
 * @创建时间 :2016年7月26日 下午1:42:48
 */
@Controller
@RequestMapping("/admin/system/log")
public class SysLogContorller extends BaseJqGridController<SysLog, SysLogService> {

	@Autowired
	public SysLogContorller(SysLogService service) {
		super("admin/system/log/", "system:log", service);
	}

	/**
	 * 清空日志接口
	 * @param model
	 * @return
	 */
	@RequiresRoles("manage")
	@RequestMapping("clear.json")
	public Model clear(Model model) {
		try {
			checkPermission(_identity);
			baseService.clear();
			return renderSuccess("", model);
		} catch (Exception e) {
			return renderFail(model, "你没有权限这样操作");
		}

	}
}
